
// 对象
const info = {
    name: "mortal",
    age: 18,
    sayHi: function () {
        console.log("hello mortal")
    }
}
// ts写法  格式:const objname:{} = {}
const obj: { name: string; age: number; sayHi(): void } = {
    name: "mortal",
    age: 18,
    sayHi: function () {
        console.log("hello mortal")
    }
}

const tys: { name: string, address: string, sayHi: (name: string) => void } = {
    name: "mortal",
    address: "北京",
    sayHi(name) {
        console.log("hello sean");
    }
}

// 可选对象类型
function mortal(name: string, obj: { name: string, age?: number }): void {
    console.log(name, obj);
}